home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000104_icon-group-sender _Wed Apr 9 06:50:35 1997.msg
< prev
next >
Wrap
Text File
|
2000-09-20
|
2KB
|
57 lines
Message-Id: <199704091946.AA11186@cheltenham.cs.arizona.edu>
Received: by cheltenham.cs.arizona.edu; Wed, 9 Apr 1997 12:46:46 MST
From: swampler@noao.edu (Steve Wampler)
Date: Wed, 9 Apr 1997 06:50:35 MST
To: icon-group@cs.arizona.edu
Subject: Re: Problem with Icon 9.3
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1626
On Apr 8 at 2:02pm, Eka Laiman writes:
} > I have the following simple (I think) program:
} >
} > link ximage
} >
} > procedure main()
} >
} > # The state diagram.
} > sd := table([])
} > sd[["q0","ok"]] := "q1"
} > sd[["q0","nok"]] := "q0"
} > sd[["q1","nok"]] := "q0"
} > sd[["q1","ok"]] := "q2"
} > # q2 is the final state
} >
} > every x := key(sd) do write(ximage(x), ":", sd[x])
} >
} > end
} >
} > This doesn't behave as I think it should. The problem seems to be a
} > table whose keys are lists. Is there something wrong with this kind of
} > structure? I don't see anything to that effect in the 3d edition of the
} > Icon book, Ch. 6 on tables.
}
} Wow, indexing using "list"s?
}
} I do not know if ICON's tables are built with this kind of operation in
} mind. I personally think that ICON tables are like "hash table" where the
} indexing can be done using both "strings" or "integers". According to the
} definition: "Tables resemble lists, except that the keys, or 'subscripts',
} need not be integers but can be *values of any type*." I have not tried to
} do indexing based on "float" yet, although theoretically that's possible
} :-)
}
} If I were you, I would first convert the list into "string" and use the
} resulting string as the key.
There is nothing at all wrong with indexing tables with anything, including
lists, sets, and tables. In fact, his code works on my system exactly
as I would expect.
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
O Sibile, si ergo, fortibus es inero.
Nobile, demis trux. Demis phulla causan dux.